package com.example.hello.entity;

import org.springframework.data.mongodb.core.mapping.Document;

/**
 * @author sjw
 * @className User
 * @date 2022/5/23 14:29
 * @description: TODO
 */

@Document("user")
public class User {
    /**
     * 数据库自动生成id
     */
    private String id;

    private String name;

    private Integer age;

    private String address;

    private Integer version = 0;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getVersion() {
        if (version == null) return 0;
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }
}
